//! 简化的宏实现
//! 
//! 由于 proc-macro 的复杂性，这里提供一个简化的实现方案

/// 统一API属性宏的简化版本
/// 
/// 这个宏目前主要用于文档标记，实际的路由注册需要在各个框架的初始化代码中完成
#[macro_export]
macro_rules! uni_api {
    // 基本路由
    ($method:literal, $route:literal) => {
        #[utoipa::path(
            method = $method,
            path = $route,
            responses(
                (status = 200, description = "Success")
            )
        )]
    };
    
    // 带认证策略的路由
    ($method:literal, $route:literal, auth_policy = $policy:expr) => {
        #[utoipa::path(
            method = $method,
            path = $route,
            security(
                ("jwt_auth" = [])
            ),
            responses(
                (status = 200, description = "Success"),
                (status = 401, description = "Unauthorized"),
                (status = 403, description = "Forbidden")
            )
        )]
    };
    
    // 带标签的路由
    ($method:literal, $route:literal, tag = $tag:literal) => {
        #[utoipa::path(
            method = $method,
            path = $route,
            tag = $tag,
            responses(
                (status = 200, description = "Success")
            )
        )]
    };
    
    // 完整版本
    ($method:literal, $route:literal, auth_policy = $policy:expr, tag = $tag:literal) => {
        #[utoipa::path(
            method = $method,
            path = $route,
            tag = $tag,
            security(
                ("jwt_auth" = [])
            ),
            responses(
                (status = 200, description = "Success"),
                (status = 401, description = "Unauthorized"),
                (status = 403, description = "Forbidden")
            )
        )]
    };
}

/// 为函数添加统一API标记的便捷宏
#[macro_export]
macro_rules! api_route {
    // GET 请求
    (get $route:literal) => {
        $crate::uni_api!("GET", $route)
    };
    
    (get $route:literal, auth_policy = $policy:expr) => {
        $crate::uni_api!("GET", $route, auth_policy = $policy)
    };
    
    (get $route:literal, tag = $tag:literal) => {
        $crate::uni_api!("GET", $route, tag = $tag)
    };
    
    (get $route:literal, auth_policy = $policy:expr, tag = $tag:literal) => {
        $crate::uni_api!("GET", $route, auth_policy = $policy, tag = $tag)
    };
    
    // POST 请求
    (post $route:literal) => {
        $crate::uni_api!("POST", $route)
    };
    
    (post $route:literal, auth_policy = $policy:expr) => {
        $crate::uni_api!("POST", $route, auth_policy = $policy)
    };
    
    (post $route:literal, tag = $tag:literal) => {
        $crate::uni_api!("POST", $route, tag = $tag)
    };
    
    (post $route:literal, auth_policy = $policy:expr, tag = $tag:literal) => {
        $crate::uni_api!("POST", $route, auth_policy = $policy, tag = $tag)
    };
    
    // PUT 请求
    (put $route:literal) => {
        $crate::uni_api!("PUT", $route)
    };
    
    (put $route:literal, auth_policy = $policy:expr) => {
        $crate::uni_api!("PUT", $route, auth_policy = $policy)
    };
    
    (put $route:literal, tag = $tag:literal) => {
        $crate::uni_api!("PUT", $route, tag = $tag)
    };
    
    (put $route:literal, auth_policy = $policy:expr, tag = $tag:literal) => {
        $crate::uni_api!("PUT", $route, auth_policy = $policy, tag = $tag)
    };
    
    // DELETE 请求
    (delete $route:literal) => {
        $crate::uni_api!("DELETE", $route)
    };
    
    (delete $route:literal, auth_policy = $policy:expr) => {
        $crate::uni_api!("DELETE", $route, auth_policy = $policy)
    };
    
    (delete $route:literal, tag = $tag:literal) => {
        $crate::uni_api!("DELETE", $route, tag = $tag)
    };
    
    (delete $route:literal, auth_policy = $policy:expr, tag = $tag:literal) => {
        $crate::uni_api!("DELETE", $route, auth_policy = $policy, tag = $tag)
    };
}